              RUNNING MICROSOFT DOS 5.0 ON THE PCjr

Microsoft has released the new and improved MS-DOS 5.  You can
read the reviews in the national computer magazines to find out
about the changes and the added features which make this upgrade
exciting.  However, you won't find the answer to a key question: 
Will DOS 5 run on the IBM PCjr?  The answer is yes, but only
after you overcome several problems.  I'll describe those
problems and how to solve them, so you can install and use DOS 5
on your Junior.

My experience with DOS 5 began last winter as a Beta tester for
Microsoft.  The first thing I learned was that the MS-DOS 5 disks
are not bootable.  You can't just put one of them in drive A and
turn on your computer.  Instead, you must run SETUP.EXE, which is
on the first of the upgrade disks, to unpack the compressed
files.

SETUP unpacks the appropriate files on the six 360K floppies in
the MS-DOS 5 upgrade package and copies them to seven working
disks configured for your video system.  The first disk, which
you label "Startup", is bootable, and the other six contain
supplemental programs.  If you have a bootable hard disk as drive
C, SETUP will install DOS there and create a subdirectory with
all the supplemental programs.  Approximately 2.8 megabytes of
disk space are required.


                   PROBLEM ONE:  MS-DOS vs. PC-DOS

The first problem is that SETUP.EXE with the Microsoft version of
DOS 5 will not run under the IBM PC-DOS 2.10 that came with your
PCjr.  In order to unpack the MS-DOS 5 disks, you must be running
a version of MS-DOS.  IBM provides their own version of DOS 5 to
upgrade IBM PC-DOS, but I have not tried it yet.


                  PROBLEM TWO:  SETUP.EXE VIDEO

When you run SETUP, it automatically configures itself to the
video system of the computer.  Unfortunately, SETUP does not
recognize PCjr video as CGA compatible.  Instead, it reports that
a monochrome Hercules graphics board is present and tries to set
that video mode.  Since this is incompatible with the PCjr, SETUP
comes up in 40 column, black and white mode.

In 40 column mode, the SETUP screens are close to unreadable
because the ends of many lines overwrite parts of others.  In
particular, I could not decipher the messages for when to swap
disks and failed in my first attempts to create the seven DOS 5
working disks.

Here are four solutions that I have found.  First, run SETUP on
a PCjr equipped with a Racore second disk drive.  It ran
correctly on the Racore system I tried.  Second, install DOS 5 on
another computer.  Create a boot disk with the FORMAT /S command
and copy the supplemental programs to additional disks.  You will
also have to manually change the video selection for the DOS
Shell if it was not installed for CGA.  Third, run SETUP as best
you can which should, at least, get you a bootable disk.  You
will then have to unpack the supplemental programs individually
with the EXPAND.EXE program.  Fourth, create the memory resident
program HOLD80JR.COM which is described in the next paragraph. 
Running HOLD80JR before SETUP will keep the screen in 80 column
mode and eliminate the video problems with SETUP.


                            HOLD80JR

To create HOLD80JR, start DEBUG.COM from your current version of
DOS.  Type in the commands exactly as shown in DEBUG Listing 1. 
After the "A 0100" command, DEBUG will return numbers which are
memory addresses.  You can disregard these as you type in the
rest of the commands. The semicolons and the comments which
follow them do not have to be typed.  They are only to explain
the program.  For the blank lines to end assembly, simply hit the
Enter key.

If you prefer, you can create a script for DEBUG by typing the
commands in a word processor and saving the file in ASCII format
with the name HOLD80JR.SCR.  This has the advantage of allowing
easy correction of any typos.  Create HOLD80JR.COM by redirecting
the script file into DEBUG with the command:  DEBUG < HOLD80.SCR. 
(Both DEBUG.COM and HOLD80JR.SCR must be on disk in the default
drive if you do not specify paths.)


DEBUG Listing 1.  HOLD80JR.COM

N HOLD80JR.COM
F 100 L500 90
A 0100
;
; HOLD80JR prevents calls to Int 10 hex from changing video
; mode to 40 column text.  All video calls are converted to
; a call for 80 column color, mode 3.
;
JMP 0300        ;Jump to initialization code, 3 bytes
;
; Store old INT 10H offset and segment here at Offset 0103
DW 0000
DW 0000
; Blank line follows to end Assembly

A 0108
STI             ;Turn interrupts back on
PUSH DS         ;Save DS and CS
PUSH CS         ;Move CS into
POP DS          ;     DS
CMP AH,00       ;If AH=00, Service 0 of INT 10H was called.
                ;     Video mode is being set.
JNZ 0120        ;If greater than 00, exit via old INT 10H
MOV AL,03       ;Reset call to 80 column color mode 3
JMP 120         ;Exit via INT 10H
; Blank line follows to end Assembly

A 0120
; This is the Exit via old INT 10H.
PUSHF
CALL FAR [0103]
POP DS          ;Restore DS register
IRET
; End of resident code at Offset 0127
; Blank line follows to end Assembly

A 0200
; Installation Message.  This will not remain resident.
DB 0A 0D
DB "All attempts to change video mode will be ignored."
DB 0A 0D 0A 0D
DB "Reboot to remove HOLD80JR from memory."
DB 0A 0D 24
; End of message
; Blank line follows to end Assembly

A 0300
; Initialization code.  This will not remain resident.
MOV AX,3510     ;Use Service 35 to get INT 10H address
INT 21          ;     Segment:Offset returned in ES:BX
MOV [0103],BX   ;Store old INT 10H offset at 0103
MOV [0105],ES   ;     and segment at 0105
MOV AX,2510     ;Point new INT 10H vector at our routine
MOV DX, 0108    ;Start of our new routine
INT 21
MOV AH,09       ;Set up to display message
MOV DX, 0200    ;Point to start of message 
INT 21          ;Display it
MOV DX, 0127    ;Point to end of code to remain resident
INT 27          ;Exit with Terminate and Stay Resident
; End of Initialization at Offset 0321
; Blank line follows to end Assembly
 
RCX
0221
W
Q


After you type Q and press the Enter key (or after the Q is read
from the script file), you will quit DEBUG and return to the DOS
prompt.  HOLD80JR.COM will have been written to the disk.

When you want to install DOS 5, run HOLD80JR.COM first, then
start SETUP.  The screen will stay in 80 column mode, and all the
messages will be readable.


                        RUNNING SETUP.EXE

To install DOS 5 on floppies, give the command: SETUP /F.  Follow
the on screen instructions to select installation on disks in
drive A for single drive systems or B for two drive systems. 
Next change the "Display Type" from Hercules to CGA.  This will
allow SETUP to select the correct driver files for the DOS Shell
program.  Continue to follow the on screen commands for swapping
the six DOS disks and the seven new disks in and out of the
drives until all the files are unpacked and copied to the working
disks.  The whole process takes about 15 minutes.

At the end of the SETUP program, you are instructed to reboot
your computer with the new disk you have labeled "Startup", the
boot disk, in drive A.  If you try it, you will be dropped into
Cassette or Cartridge BASIC, just as though there were no disk at
all in the drive.  We have two more problems which must be solved
before you can run DOS 5.


             PROBLEM THREE:  DOS 5 REQUIRES 256K RAM

DOS 5 will only load on computers with 256K or more of RAM. 
Although your PCjr may have 640K of RAM, the system initially
informs DOS of only 128K.  Later in the boot process, your memory
management software (JRCONFIG.DSK, PCJRMEM.COM, etc.) is supposed
to change this initial 128K value to the true amount of RAM. 
With DOS 5, this approach fails.

When DOS 5 sees only 128K initially, it refuses to load.  Your
PCjr drops into BASIC, and the memory management software never
runs.  What we need is a way to change the amount of RAM reported
initially from 128K to the full amount before DOS is loaded. 
Fortunately, we can patch the boot record on the disk to do this
for us.

The boot record is a small program written to the first sector of
every disk when it is formatted.  Although it is on every disk,
the boot record is normally accessed only on boot disks because
it has the instructions for loading DOS from the disk into RAM. 
We can edit the boot record of our DOS 5 boot disk with DEBUG to
include the instructions we need to solve the 256K RAM problem.

Since altering the boot sector is a bit unusual, you may want to
make a DISKCOPY of the DOS 5 Startup disk to experiment on first. 
Use DISKCOPY not COPY so that the hidden files are copied.

The easiest way to do this patch is to copy the old version of
DEBUG to the DOS 5 disk.  (You must use DEBUG from your old
version of DOS since you cannot yet boot up with DOS 5.)  You can
delete one or more files which cannot be used with the PCjr from
your DOS 5 disk to make room.  Deleting EGA.SYS and EGA.CPI will
free up 63K which is more than enough.

If you have more than one drive, be sure to put the DOS 5 disk in
the A drive.  Start DEBUG and type in the commands exactly as
shown in DEBUG Listing 2.  The semicolons and comments which
follow may be omitted.  Since you may want to patch more than one
disk, I suggest you create a script for DEBUG as described for
HOLD80JR.SCR.  I call this one DOS5BOOT.SCR.  Copy it to the DOS
5 disk in drive A and issue the command:  DEBUG < DOS5BOOT.SCR.

If the first command, "U 0000 L 3" does not display "xxxx:0000
xxxx JMP 003E" and "xxxx:0002 xx NOP", where xxxx are any
characters, this patch will not work.  The "D 01A0" command will
display the message:  "Non-System disk or disk error.  Replace
and strike any key when ready."  The command "E 01BF" followed by
00 will replace the R of "Replace" to end the message at that
point.  The new code will be written in place of the remainder of
the message following the "A 01C0" command.

DEBUG Listing 2.  Boot Sector Patch for DOS 5

L 0 0 0 1
U 0000 L 3
A 0000
JMP 01C0
; Leave blank line to end assembly

D 01A0
E 01BF
00
A 01C0
; Put PCjr code here, overwrite after R of "Replace..."
PUSH DS       ;Save current DS segment
MOV AX,40     ;
MOV DS,AX     ;Point at ROM BIOS data area at 0040:00
MOV AX,[0015] ;Point at True RAM size
MOV [0013],AX ;Put it in Usable RAM size instead of 128K
;
; If you have 2 or 3 drives, omit the ;; (two semicolons) in
; the left margin of line 1 and either line 2 or 3 (not both).
;
;;AND BYTE PTR [0010],3F ;1. Point to byte at 0040:0010
                         ;   Zero bits for number of drives
;;OR BYTE PTR [0010],40  ;2. Set bits to indicate 2 drives
;;OR BYTE PTR [0010],80  ;3. Set bits for 3 disk drives
POP DS        ;Restore original DS
JMP 003E      ;Jump back to normal start of boot record
;Leave blank line to end assembly

W 0 0 0 1
Q


After the "Q" command, you will be returned to the DOS prompt,
and the modified boot sector will have been written to the DOS 5
Startup disk in drive A.  When you boot up, DOS 5 will know the
true amount of RAM your PCjr has (up to 640K) and the number of
disk drives as well.  If you have 736K of RAM, replace the "MOV
AX,[0015]" line with "MOV AX,02E0" (note that there are no
brackets).  Don't forget to delete the old version of DEBUG from
this disk when you are done.

Before attempting to boot DOS 5, copy your memory management
software and any other essential files such as clock utilities to
the new boot disk.  Write or modify the CONFIG.SYS and
AUTOEXEC.BAT files as necessary.


                PROBLEM FOUR:  THE STACKS COMMAND

You are almost ready to boot up DOS 5.  All you have to do now is
edit the CONFIG.SYS file to include the line "STACKS=0,0"
(without the quotes) as the very first line.  Put this ahead of
everything, even your memory management device driver if you use
one.  When I omitted this line, my keyboard was locked up after
booting, and all my PCjr did was beep at me.

That's it!  You are now ready to explore the intriguing new
features of DOS 5.  Your modified Startup disk will boot DOS 5 on
any PCjr with 256K or more RAM.  You can create additional DOS 5
boot disks by using DISKCOPY to copy your first boot disk, or you
can use the DOS5BOOT.SCR procedure on every new boot disk. 
Ordinary data disks do not need to be modified.


                 MS-DOS 5.0 VS. IBM PC-DOS 2.10

The files for DOS 5 are larger than for early versions and take
up more disk space.  For example, all boot disks must have three
DOS files, COMMAND.COM and the two hidden system files.  For IBM
PC-DOS 2.10, these files occupy only 40,960 bytes of disk space. 
With MS-DOS 5.0, the same three files occupy 119,808 bytes.  As a
result, there is less room on DOS 5 boot disks for everything
else.  If you like to run programs from self-booting disks, you
may not be able to fit everything on one disk if you upgrade.

Since DOS 5 is larger than earlier versions, it also takes longer
to boot up.  Fortunately, the boot sector patch reduces the time
required by eliminating the warm reboot normally done by the
memory management software.  As a result, DOS 5 takes only nine
to ten seconds longer to load than DOS 2.1 even though it is
three times the size.

DOS 5 also occupies more memory.  The amount of RAM used by DOS
is shown in Table I for two configurations using JRCONFIG.DSK
version 2.15 for memory management.  In the first case, a minimum
ramdisk was created by using -S0 on the "DEVICE=JRCONFIG.DSK"
line in the CONFIG.SYS file.  In the second, a ramdisk large
enough to fill the first 128K of RAM was created by omitting the
-S parameter entirely.  This is a better memory configuration
since programs will load in the expansion memory above 128K and
run faster.


Table I.  RAM Usage for IBM PC-DOS 2.10 and MS-DOS 5.0.

                         PC-DOS 2.10   MS-DOS 5.0   Difference
Free RAM with Minimum
  Ramdisk (-S0)             588K          562K        - 26K
Ramdisk Size                 10K            1K        -  9K

Free RAM with Ramdisk
  to Fill first 128K        508K          498K        - 10K
Ramdisk Size                 89K           64K        - 25K


Table I shows that DOS 5.0 consumes only 35K more RAM than
DOS 2.1 even when the decreased ramdisk size is included.  If you
normally copy COMMAND.COM to a ramdisk, the larger command
processor for DOS 5.0 (47,845 bytes vs. 17,792 bytes for DOS 2.1)
will require an extra 30K of RAM allocated to the ramdisk.

DOS 5.0 requires the use of HUSH.COM or the -X switch with
JRCONFIG to reset the PCjr disk drive parameters to minimize
drive noise.  This is the same as with DOS 3.0 and higher.


                 PROBLEM FIVE:  THE SHELL COLORS

When you start DOSSHELL.EXE, the screen will come up with
several blinking areas which is very annoying.  Happily, this is
a minor problem compared to the ones we have dealt with so far. 
The easiest solution is to simply select the Eight Colors or
Mono 2 options from the Colors selection of the Options menu as
described in the manual.

The source of the problem is the DOSSHELL.INI file for the
CGA display.  Background colors used for some areas of the
screen, which are normal with the standard CGA card, blink on the
PCjr.  You can correct the problem by editing the INI file with
the new DOS Editor.  Look for the "title = Ocean" line which
identifies the default color selection.  Scroll down to the
"background =" section and replace the offending "brightwhite"
color with "white" and "brightcyan" with "cyan."  For a final
touch replace the "white" color for "elevator" and "titlebar"
with "cyan" or another color so they will stand out from the
background.


             PROBLEM SIX:  SOFTWARE INCOMPATIBILITY

Most programs will work as usual with DOS 5.  However, disk
optimizer (defragmenter) programs will require an upgrade as will
any other programs such as PC Tools or the Norton Utilities that
deal with disks in special ways.

Some programs won't run only because they expect a lower DOS
version number than 5.  SERVER.EXE is provided to handle this
problem as described in the manual.

Some mouse drivers will have to be upgraded to work properly
under DOS 5.  Logitech provides free upgrades on their BBS to
version 5 drivers.

Microsoft provides a text file on one of the upgrade disks
detailing some additional incompatibilities.


                       PATCHING FORMAT.COM

As a final touch, I patched FORMAT.COM to provide the modified
boot sector required for DOS 5 boot disks, so that disks prepared
with the FORMAT /S command would not have to be patched
separately.  As you might expect, the changes made to FORMAT.COM
look a lot like the boot sector patch.

The easiest way to do this patch is to place FORMAT.COM and
the DOS 5 DEBUG.EXE on the same disk.  Give the command to start
DEBUG and load FORMAT.COM:  DEBUG FORMAT.COM.  Type in the
commands exactly as shown in DEBUG Listing 3 omitting the
semicolons and comments.

A DEBUG script is always a good idea, and I called this one
FORMATJR.SCR.  As with the boot sector patch, if you have more
than one disk drive, you will have to edit FORMATJR.SCR for the
number of drives.  Execute the patch with FORMAT.COM, DEBUG.EXE,
and FORMATJR.SCR on the same disk, by issuing the command: 
DEBUG FORMAT.COM < FORMATJR.SCR.

If the "U 0D6C L3" command does not display "xxxx:0D6C xxxx JMP
0DAA" and "xxxx:0D6E xx NOP" this patch will not work.


DEBUG Listing 3.  Patch for FORMAT.COM

D 0F0C
U 0D6C L 3
A 0D6C
JMP 0F2C      ;Replace with JMP to our PCjr code at 0F2C 
; Leave blank line to end assembly

E 0F2B
00
A 0F2C 
; Put PCjr code here, overwrite after R of "Replace..."
PUSH DS       ;Save current DS segment
MOV AX,40     ;
MOV DS,AX     ;Point at ROM BIOS data area at 0040:00
MOV AX,[0015] ;Point at True RAM size
MOV [0013],AX ;Put it in Usable RAM size instead of 128K
;
; If you have 2 or 3 drives, omit the ;; (two semicolons) in
; the left margin of line 1 and either line 2 or 3 (not both).
;
;;AND BYTE PTR [0010],3F ;1. Point to byte at 0040:0010
                         ;   Zero bits for number of drives
;;OR BYTE PTR [0010],40  ;2. Set bits to indicate 2 drives
;;OR BYTE PTR [0010],80  ;3. Set bits for 3 disk drives
POP DS        ;Restore original DS
JMP 0DAA      ;Jump back to normal start of boot record
; Rename the file FORMATJR.COM, write it to disk, and quit.
; Leave blank line to end assembly
 
N FORMATJR.COM
W
Q


When you are done, FORMATJR.COM will have been written to the
disk.  This is the special version for your number of disk
drives.  If you want to format a disk for a system with a
different number of drives, you will have to repatch FORMAT.

NOTE:  you must not use FORMATJR.COM to create boot disks for
use on any computer except the IBM PCjr because of the special
changes in the boot sector which FORMATJR.COM creates.


                          IN CONCLUSION

Well, that summarizes all I know about DOS 5.0 and the PCjr at
this time.  I'm not sure if I was the only Beta tester with a
PCjr, but there must not have been many because Microsoft sure
didn't feel compelled to make it easy to run their new DOS on our
Juniors.

Now you know you can run DOS 5 on your PCjr if you want to.  Read
the magazine articles and decide whether the upgrade will benefit
you sufficiently.  There are a lot of exciting new features here,
but some require an 80286 or higher microprocessor and others
may only be practical on systems with a hard disk simply due to
their size.

John M. King
June 30, 1991
